﻿$(document).ready(function ()
{
    $(".editProfile").click(function ()
    {
        $("#profileEditForm").submit(function (event)
        {
            event.preventDefault();

            var $form = $(this),
                ID = $form.find('input[name="idField"]').val(),
                name = $form.find('input[name="nameField"]').val(),
                password = $form.find('input[name="passwordField"]').val(),
                mail = $form.find('input[name="emailField"]').val();
                //var picture = $form.find('input[name="pictureField"]').val(),
                //age = $form.find('input[name="ageField"]').val(),
                //sex = $form.find('select[name="sexSelect"]').val();
            
            url = "/User/EditProfile";
            $.post(url, { ID: ID, userName: name, passw: password, email: mail }, function (data)
            {
                window.location.replace("/User/ViewProfile/" + data.id);
            });
        });
    });
});